// set是es6的一种新的数据类型

// 它类似数组但成员值是唯一的

let set = new Set();
let array = [1, 2, 3, 6, 5, 2, 5, 1, 2, 1, 25, 1, 54, 2];
array.forEach(element => {
    set.add(element);
});
// console.log(set);//Set { 1, 2, 3, 6, 5, 25, 54 }
let arrayNew = [];
for (const i of set) {
    arrayNew.push(i)
}
// console.log(arrayNew);//[ 1, 2, 3, 6, 5, 25, 54 ]
// console.log(arrayNew.sort(function(a,b){return b-a}));//[ 54, 25, 6, 5, 3, 2, 1 ]


let array_3 = [...set];
// console.log(array_3);//[ 1, 2, 3, 6, 5, 25, 54 ]

// console.log(set.delete(25));//false
// console.log(set);//Set { 1, 2, 3, 6, 5, 54 }

